package com.selune.online.ordering.system.autoconfigure;

import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * Created with IntelliJ IDEA.
 *
 * @author xiaoyp
 * @date 2020/3/26
 * <p>
 * Description:
 */
//@Configuration
@EnableSwagger2
public class SwaggerConfigure {
	
	@Bean
	public Docket createSwagger() {
		return new Docket(DocumentationType.SWAGGER_2)
			.apiInfo(apiInfo())
			.pathMapping("/")
			.select()
			.apis(RequestHandlerSelectors.basePackage("com.selune.online.ordering.system.project"))
			.paths(PathSelectors.any())
			.build();
	}
	
	private ApiInfo apiInfo() {
		return new ApiInfoBuilder()
			.title("在线点餐系统")
			.description("毕业设计swagger-ui")
//			.termsOfServiceUrl("https://gitee.com/codeselune/graduation_project/tree/development/")
			.contact(new Contact("xiaoyp", "https://gitee.com/codeselune/graduation_project/tree/development/", "xyp_selune@163.com"))
			.version("1.0")
			.build();
	}
}
